PHP-Tester
For PHP Unit testing through PHP scripts (NOT command line)
Notice Oct 14, 2019
I think this is ready to use. It's nothing fancy, but it works! I'm not sure if the current readme is accurate, though.
composer
composer require rof/unit-tester dev-master
or json version
{"require":{
"rof/unit-tester": "dev-master"
}}
or something like that.
This is intended for personal use. I have no idea whether this will become robust or not. First version is so so simple.
Make a class like MyTester extends \ROF\Tester
.
Write functions. Try testCamelCasedFunction
.
have them return TRUE
or FALSE
for PASS or FAIL, respectively
Call MyTester::runAll()
or MyTester::runTests('testCamelCasedFunction');
or MyTester::runTests(['testOne','testTwo','testThree']);
. You may also do $tester = new MyTester(); $tester->run();
Then remind yourself that programming is hard and you'll get it right on the second... or third... or fourth... or five-thousandth time.
You may override prepare
, if you need to do anything prior to running your tests.